<template>
  <div>
    <div>
      <button @click="bun_OpenDialog()">打开对话框</button>
      <button @click="bun_SaveDialog()">保存对话框</button>
      <button @click="bun_MessageDialog()">消息对话框</button>
      <button @click="bun_ErrorDialog()">错误对话框</button>
    </div>


  </div>
</template>

<style scoped>
</style>

<script>
  const { dialog } = require('electron').remote

  export default {
    name: '',
    //传参：父传子，写法：["形参1"[,"形参2"]]
    props: {

    },
    created() {

    },
    mounted() {

    },
    data() {
      return {

      }
    },
    methods: {
      //打开文件对话框
      bun_OpenDialog() {
        let filePath = dialog.showOpenDialog({
          title: "标题",
          filters: [
            { name: '类型名称', extensions: ['exe'] },
            { name: '所有文件', extensions: ['*'] }
          ]
        })
        console.log(filePath);
      },

      //保存文件对话框
      bun_SaveDialog() {
        let filePath = dialog.showSaveDialog({
          title: "标题",
          filters: [
            { name: '类型名称', extensions: ['exe'] },
            { name: '所有文件', extensions: ['*'] }
          ]
        })
        console.log(filePath);
      },

      //消息对话框
      bun_MessageDialog(){
        let message = dialog.showMessageBox({
          type: "warning",
          title: "标题",
          message: "内容",
          buttons: ["确定","取消"]
        })
        console.log(message);
      },

      //错误对话框
      bun_ErrorDialog(){
        dialog.showErrorBox("标题", "内容")
      }
    },
    mixins: [],
    components: {

    },
  }
</script>